package com_6;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class StudentDemo {
    public static void main(String[] args) {//
        ArrayList<Student> array = new ArrayList<>();//
        array.add(new Student("乔峰", 1));//
        array.add(new Student("段玉", 2));//
        array.add(new Student("小龙女", 2));//
        array.add(new Student("佐治", 8));//
        array.add(new Student("乔巴", 9));//
        System.out.println(array);
        Collections.sort(array, new Comparator<Student>() {//
            @Override
            public int compare(Student s1, Student s2) {//
                int i = s1.getAge() - s2.getAge();
                return 0;
            }
        });

    }
}
